package fb4java.beans;


import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;


public class Notification {
    public long notificationId;
    public long senderId;
    public long recipientId;
    public Date createdTime;
    public Date updatedTime;
    public String titleHtml;
    public String titleText;
    public String bodyHtml;
    public String bodyText;
    public String href;

    public Notification() {
    }

    public Notification(JSONObject obj) throws JSONException {
        initByJSONObject(obj);
    }

    public void initByJSONObject(JSONObject obj) throws JSONException {
        notificationId = obj.getLong("notification_id");
        senderId = obj.getLong("sender_id");
        recipientId = obj.getLong("recipient_id");
        createdTime = new Date(obj.getLong("created_time") * 1000);
        updatedTime = new Date(obj.getLong("updated_time") * 1000);
        titleHtml = obj.getString("title_html");
        titleText = obj.getString("title_text");
        bodyHtml = obj.getString("body_html");
        bodyText = obj.getString("body_text");
        href = obj.getString("href");
    }
}